﻿@model Webcar.Entitys.RP_CAR_REPAIR_HEAD

@{ Layout = "~/Views/Shared/_leftPanelLayout.cshtml";}
@section LeftTree
{
     
    @{
        Html.RenderPartial("DeptTreePartialView", new Webcar.Models.DeptTreeMode { Action = "List", Controller = "Repair" ,ShowChild=false });
     }
}

    
@using (Html.BeginForm("Edit", "Repair", Html.ViewContext.RouteData.Values,FormMethod.Post))
{
    @Html.AntiForgeryToken()
    <div id="edit-car" style="width:700px;margin:5px 5px 5px 5px">
    @Html.HiddenFor(a => a.REPAIR_NO)
    @Html.HiddenFor(a => a.CAR_NO)
    @Html.HiddenFor(a => a.DRIVER)

        <table class="edit-table">
            <tr>
                <td style="width: 80px; text-align: right;">*所属单位：</td>
                <td colspan="3">@Html.DropDownListFor(a => a.DEPT_CODE, WebcarDataHelper.UserSuperDeptList, new { @style = "width: 100%;", @onchange = "changeDept();" })</td>
                
            </tr>

            <tr>
                <td style="width: 80px; text-align: right">*牌照号：</td>
                <td style="width: 200px">@Html.TextBoxFor(a => a.RECORD_NO, new { @style = "width: 100%;", @onkeyup = "this.value=this.value.toUpperCase();" })</td>
                <td style="width: 80px; text-align: right">*驾驶员：</td>
                <td style="width: 200px">@Html.TextBox("DriverName",(string)@ViewBag.DriverName)</td>
            </tr>
            
            <tr>
                <td style="width: 80px; text-align: right">*承修单位：</td>
                <td style="width: 200px">@Html.TextBoxFor(a => a.REPAIR_DEPT)</td>
                <td style="width: 80px; text-align: right">*维修类别：</td>
                <td style="width: 200px">@Html.DropDownListFor(a => a.REPAIR_KIND, new SelectList(WebcarDataHelper.RepairKind, "Item1", "Item2"))</td>
            </tr>

            <tr>
                <td style="width: 80px; text-align: right;">*进厂日期：</td>
                <td>@Html.CalendarFor(a=>a.ENTER_DATE)</td>
                <td style="width: 80px; text-align: right">*出厂日期：</td>
                <td>@Html.CalendarFor(a=>a.OUT_DATE)</td>
            </tr>
            <tr>
                <td style="width: 80px; text-align: right;">工时费：</td>
                <td>@Html.TextBoxFor(a=>a.HOUR_FEE)</td>
                <td style="width: 80px; text-align: right">管理费：</td>
                <td>@Html.TextBoxFor(a=>a.MANAGE_FEE)</td>
            </tr>
            <tr>
                <td style="width: 80px; text-align: right;">大修检验人：</td>
                <td>@Html.TextBoxFor(a=>a.CHECKMAN_DX)</td>
                <td style="width: 80px; text-align: right">修理检验人：</td>
                <td>@Html.TextBoxFor(a=>a.CHECKMAN)</td>
            </tr>
            <tr>
                <td style="width: 80px; text-align: right;">维修原因：</td>
                <td colspan="3">@Html.TextAreaFor(a => a.REPAIR_CAUSE,7,30,new { @style = "width: 100%;" })</td>
            </tr>

        </table>
        <br />
        <div class="validation-errors">@ViewBag.ErrorMessage</div>
    </div>
    <table style="width:700px">
        <tr>
            <td style="width:650px"></td>
            <td>
                @Html.DevExpress().Button(settings =>
                {
                    settings.Name = "Button1";
                    settings.Text = CurrentUser.CheckPermission(PermissionManager.编辑维修单) ? "保存" : "无权限";
                    settings.Enabled = CurrentUser.CheckPermission(PermissionManager.编辑维修单);
                    settings.UseSubmitBehavior = true;
                    settings.Width = 70;
                    settings.ControlStyle.CssClass = "button1";
                }).GetHtml()
                

            </td>
            <td>
                @Html.DevExpress().Button(settings =>
                {
                    settings.ControlStyle.CssClass = "button2";
                    settings.Name = "Button2";
                    settings.Text = "取消";
                    settings.Width = 70;
                    settings.ClientSideEvents.Click = "function(s, e){ location.href='" + @Url.Action("List", "Repair") + "' }";
                }).GetHtml()
            </td>
        </tr>

    </table>
}       
 

<script type="text/javascript">
$(function () {
    changeDept();
    
    $("#RECORD_NO").change(function () {
        $("#CAR_NO").val("");
    });
    $("#DriverName").change(function () {
        $("#DRIVER").val("");
    });
    
});
function changeDept() {
    setCarAutoComplete("RECORD_NO", $("#DEPT_CODE").val(),
        '@Url.Action("GetAutoCompleteCar","Common")',
        function (event, ui) {
            $("#CAR_NO").val(ui.item.key);
        }
    );
    setDriverAutoComplete("DriverName", $("#DEPT_CODE").val(), '@Url.Action("GetAutoCompleteDriver","Common")',
        function (event, ui) {
            $("#DRIVER").val(ui.item.key);
        });
};
</script>    